package com.yx.filesystem.storage;

import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.Serializable;
import java.util.Hashtable;

public abstract class  SocketHandler  implements Serializable {
	private static final Hashtable<String,SocketHandler> handlerPool=new Hashtable<String,SocketHandler>();
	public static final SocketHandler get(String name)throws Exception{
		if(handlerPool.containsKey(name))return handlerPool.get(name);
		SocketHandler handler=(SocketHandler)Class.forName(name).newInstance();		
		handlerPool.put(name, handler);
		return handler;
	}
	public abstract boolean handler(BufferedInputStream socketInput,BufferedOutputStream socketOutput,Transport transport)throws Exception;  
}
